import { CSSProperties } from "react"
import { CellStyleConfig, DeviceEntityRange, EntityExtraData } from "../utils/types"
import { RawDraftEntityRange, RawDraftInlineStyleRange } from "draft-js"

type TypeFontSize =
    '初号'
    | '小初'
    | '一号'
    | '小一'
    | '二号'
    | '小二'
    | '三号'
    | '小三'
    | '四号'
    | '小四'
    | '五号'
    | '小五'

type TypeFontFamily =
    '宋体'
    | '黑体'
    | '微软雅黑'
    | 'Times New Roman'


type TypeInlineStyleDict =
    'BOLD'
    | 'ITALIC'
    | 'UNDERLINE'
    | 'STRIKETHROUGH'
    | 'SUPERSCRIPT'
    | 'SUBSCRIPT'
    | 'INPUT'

interface TypeLayoutPosition {
    clienX: number
    clienY: number
};

interface OptionBarConfig {
    fontSize?: TypeFontSize  //字号
    fontFamily?: string      //字体
    inlineBgColor?: string   //行内背景色
    inlineUnderLineColor?: string   //行内下划线颜色
    inlineStrikeThroughColor?: string   //行内删除线颜色
    inlineTextColor?: string   //文字颜色
    textShadingColor?: string  //字体底纹颜色
}

interface InlineStyleConfig {
    fontSize?: TypeFontSize  //字号
    fontFamily?: string      //字体
    inlineBgColor?: string   //行内背景色
    inlineUnderLineColor?: string   //行内下划线颜色
    inlineStrikeThroughColor?: string   //行内删除线颜色
    inlineTextColor?: string   //文字颜色
    textShadingColor?: string  //字体底纹颜色
}

type OptionBarActionType =
    | 'INSERT'
    | 'SAVE'
    | 'UNDO'
    | 'REDO'

type EditorColorPickerType =
    | 'INLINE_BACKGROUND_COLOR'
    | 'TEXT_COLOR'
    | 'STRIKETHROUGH_COLOR'
    | 'UNDERLINE_COLOR'

interface TypeEditorColor {
    pickerType: EditorColorPickerType,
    color: string | any
    hex?: string
}

interface XAxisType {
    columnWidth: number
    lable: string
};

interface YAxisType {
    id: any
    pid: string
    isExpand: boolean
    rowHeight: number
    lable: number
};

interface TableDataCell {
    id?: string
    pid?: string
    serialNumber?: string
    bound: Array<number>
    type?: 'text' | 'button' | 'input' | 'expand' | 'select' | 'switch'
    serviceType?: 'investmentCompositionMoney' | 'inupt-group' | 'cell-total' | 'unit' | 'unitPrice' | 'count' | 'nearFutureMoneyRate' | 'mediumAndLongTermMoneyRate' | 'extra-total',
    editble?: boolean
    text?: any
    valueType?: 'number' | 'string'
    cellStyle?: CSSProperties
    cellStyleConfig?: CellStyleConfig
    isExpand?: boolean
    isChecked?: boolean
    isDeviceTopic?: boolean
    headLess?: boolean,
    dropDownValueList?: string[]
}

interface TypeMergeCellBound {
    id?: string
    timeSign?: number
    focusCellbound: number[]
    bounds: number[][]
    offsetX: number
    offsetY: number
}

interface TypeExcelConfig {
    mergeCellBoundGroup: Array<TypeMergeCellBound>
    tableData: Array<TableDataCell>
    xAxisList: Array<XAxisType>
    yAxisList: Array<YAxisType>
}


interface TypeEditorNav {
    type: 'excel' | 'word' | 'view' | 'export',
    name: string
}


interface SelectOptionType {
    value: any
    label: any
}

interface WordEditStyleType {
    styleName: string
    styleRule: CSSProperties
}

interface DraftBlockData {
    depth?: any
    data?: EntityExtraData,
    entityRanges?: RawDraftEntityRange[],
    inlineStyleRanges: RawDraftInlineStyleRange[],
    key: string
    text: string
    type: string
}

interface ProtectlandProblem {
    key: string
    value: string
    problemType: string
    problemDetails: string
    checked: boolean
    backgroundParagraph1?: string
    backgroundParagraph2?: string
    backgroundParagraph3?: string
    backgroundParagraph4?: string
}

interface TypeWorkBookReadResult {
    sheetName?: string
    sheetData?: string[][]
}

interface TypeProjectSubTable {
    workSheetData: any[][],
    workSheetFileName: string;
    type: "1" | '2' | '3' | '4' | '5' | '6'
    name: string
    fileName: string
    url: string
}

interface ExpensesItemType {
    value: number,
    name: string
}

export type {
    TypeFontSize,
    TypeFontFamily,
    TypeInlineStyleDict,
    TypeLayoutPosition,
    OptionBarConfig,
    OptionBarActionType,
    TypeEditorColor,
    EditorColorPickerType,
    XAxisType,
    YAxisType,
    TypeExcelConfig,
    TableDataCell,
    TypeMergeCellBound,
    TypeEditorNav,
    InlineStyleConfig,
    SelectOptionType,
    WordEditStyleType,
    DraftBlockData,
    ProtectlandProblem,
    TypeWorkBookReadResult,
    TypeProjectSubTable,
    ExpensesItemType
}